package com.hubu.admin.utils;

import lombok.Getter;

/**
 * @ClassName: ResultCode
 * @Description:
 * @Author: WangBin
 * @Date: 2023/6/18 15:30
 */
@Getter
public enum ResultCode implements IResultCode {

    /**
     * <h1 style="color:red;">成功</h1>
     */

    OK(200, "成功"),
    /**
     * <h1 style="color:red;">失败</h1>
     */
    ERROR(500, "失败"),
    UNKNOWN_ERROR(502, "未知错误"),

    /**
     * <h1 style="color:red;">数据库错误</h1>
     */
    SQL_NO_DUPLICATE_KEY(1001, "不能重复的Key"),


    /**
     * <h1 style="color:red;">参数错误</h1>
     */
    PARAM_NOT_VALID(1001, "参数无效"),
    PARAM_IS_BLANK(1002, "参数为空"),
    PARAM_TYPE_ERROR(1003, "参数类型错误"),
    PARAM_NOT_COMPLETE(1004, "参数缺失"),
    PARAM_TYPE_REPEAT(1005, "参数重复"),

    /**
     * <h2 style="color:red;">用户错误</h2>
     */
    USER_NOT_LOGIN(2001, "用户未登录"),
    USER_ACCOUNT_EXPIRED(2002, "账号已过期"),
    USER_CREDENTIALS_ERROR(2003, "密码错误"),
    USER_CREDENTIALS_EXPIRED(2004, "密码过期"),
    USER_ACCOUNT_DISABLE(2005, "账号不可用"),
    USER_ACCOUNT_LOCKED(2006, "账号被锁定"),
    USER_ACCOUNT_NOT_EXIST(2007, "账号不存在"),
    USER_ACCOUNT_NOT_NULL(2013, "账号不能为空"),
    USER_CREDENTIALS_NOT_NULL(2014, "密码不能为空"),
    USER_ACCOUNT_ALREADY_EXIST(2008, "账号已存在"),
    USER_ACCOUNT_USE_BY_OTHERS(2009, "账号下线"),
    USER_PASSWORD_SAME(2010, "新密码与原密码一致"),
    USER_ACCOUNT_OR_PASSWORD_NOT_NULL(2016, "账号或者密码不能为空"),

    /* token错误 */
    TOKEN_ERROR(2001,"token异常"),

    /* 业务错误 */
    BUSINESS_NO_PERMISSION(3001, "没有权限"),
    BUSINESS_ADD_FAIL(3002, "新增失败"),
    BUSINESS_UPDATE_FAIL(3003, "更新失败"),
    BUSINESS_DELETE_FAIL(3004, "删除失败"),
    BUSINESS_QUERY_FAIL(3005, "查询失败"),
    BUSINESS_QUERY_EMPTY(3006, "查询为空"),
    BUSINESS_QUERY_NOT_EXIST(3007, "查询不存在"),

    BUSINESS_EMAIL_ERROR(2060, "邮箱格式错误"),
    BUSINESS_PHONE_ERROR(2061, "电话格式错误"),

    BUSINESS_EMAIL_REPEAT_ERROR(2062, "邮箱已存在"),

    /* 文件读写 */
    FILE_IS_NULL(2041, "文件为空"),
    FILE_WRONG_FORMAT(2042, "文件格式错误"),
    FILE_CHUNK_UPLOAD_ERROR(2043, "文件分块上传失败！"),
    FILE_CHUNK_MERGE_ERROR(2044, "文件分块合并失败"),
    FILE_CONTENT_ERROR(2045, "上传文件内容错误"),

    /**
     * 数据导出
     */
    EXPORT_FAILURE(2100, "导出失败"),
    /**
     * 数据导入
     */
    IMPORT_FAILURE(2101, "导入失败");

    /**
     * 返回码
     */
    private Integer code;

    /**
     * 返回消息
     */
    private String message;

    ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
}

